package com.cnswhy.cloud.server.merchant.controller.cps;

import com.cnswhy.cloud.server.core.entity.CpsBankRateSplit;
import com.cnswhy.cloud.server.core.dto.CpsBankRateSplitSaveDTO;
import com.cnswhy.cloud.server.core.dto.CpsBankRateSplitUpdateDTO;
import com.cnswhy.cloud.server.core.dto.CpsBankRateSplitPageDTO;
import com.cnswhy.cloud.server.core.service.CpsBankRateSplitService;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.cnswhy.cloud.common.core.base.controller.SuperController;
import com.cnswhy.cloud.common.core.base.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
//import com.github.zuihou.security.annotation.PreAuth;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 前端控制器
 * 
 * </p>
 *
 * @author cnswhy
 * @date 2021-02-18
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/cpsBankRateSplit")
@Api(value = "CpsBankRateSplit", tags = "")
//@PreAuth(replace = "cpsBankRateSplit:")
public class CpsBankRateSplitController extends SuperController<CpsBankRateSplitService, Long, CpsBankRateSplit, CpsBankRateSplitPageDTO, CpsBankRateSplitSaveDTO, CpsBankRateSplitUpdateDTO> {

    /**
     * Excel导入后的操作
     *
     * @param list
     */
    @Override
    public R<Boolean> handlerImport(List<Map<String, String>> list){
        List<CpsBankRateSplit> cpsBankRateSplitList = list.stream().map((map) -> {
            CpsBankRateSplit cpsBankRateSplit = CpsBankRateSplit.builder().build();
            return cpsBankRateSplit;
        }).collect(Collectors.toList());

        return R.success(baseService.saveBatch(cpsBankRateSplitList));
    }
}
